Avorion Script API Documentation
ShipDatabaseEntry [Client]
This represents an interface to a database entry of a ship of a Player or Alliance (=ShipOwner). When writing values here, proceed with caution and note that many database entries that linked directly to the ship will be overridden steadily (when changed on the ship) while it's being simulated in a sector. It only makes sense to update these values if the ship is in background simulation, and you want to change properties of the ship.
Note: Changing the name or faction properties of the instance will make the instance point to another faction/ship of that faction. It will not change the faction or name of the ship. If you want to change the ship's name, use the setNewName() function. Changing the ship's faction is not possible with this.
This object is only available on the client.
function ShipDatabaseEntry(int faction, string name)
Returns
A new instance of ShipDatabaseEntry
property int faction |
property string name |
property int numBlocks | [read-only] |
function Crew buildIdealCrew()
function bool exists()
function ShipAvailability getAvailability()
function Captain getCaptain()
function table<TradingGood, float>, float getCargo()
Returns the current cargo and the cargo bay size. The cargo is stored in a table of the format result = { }; result[good1] = 5; result[good2] = 4; ... etc. The goods are used as keys, the amount of the good is the value.
Returns
returns 2 values: 1. A table holding the current cargo of the ship; 2. a number containing the cargo bay size of the ship
function int, int getCoordinates()
function Crew getCrew()
function bool getCrewRequirementsFulfilled()
Returns a boolean whether the crew requirements of the craft are all fulfilled. These are things like overpopulation, not enough crew members, etc.
Returns
A boolean whether the crew requirements of the ship are all fulfilled.
function var getDocksEnabled()
Returns information about the crafts's docks. If in transport mode, docks are disabled. Only valid for stations.
Returns
A bool value indicating whether docks are enabled or not
function double, double getDPSValues()
Returns information about the ship's DPS.
Returns
2 values: Total turret DPS; Total fighter DPS
function var... getDurabilityProperties()
Returns information about the ship's hull durability. Returns 5 values: The maximum durability, the durability percentage, range 0 to 1; The HP malus factor (from boarding or reconstruction), 0 to 1; A MalusReason enum value, the reason for the malus; A bool indicating if the ship is currently damaged (blocks are lost)
Returns
5 values: Maximum durability; durability percentage; malus factor; malus reason, damaged
function var... getEnergyProperties()
Returns the energy properties of the craft.
Returns
Two values: required energy, produced energy in watts
function int getEntityType()
function bool getFighterSquadRequirementsFulfilled()
Returns a boolean whether the figher squad requirements of the craft are all fulfilled. That's not fulfilled when there aren't enough squads for fighters.
Returns
A boolean whether the requirements are all fulfilled.
function bool getFighterStartRequirementsFulfilled()
Returns a boolean whether the figher start requirements of the craft are all fulfilled. That's not fulfilled when there aren't any starting positions for fighters.
Returns
A boolean whether the requirements are all fulfilled.
function float getFreeCargoSpace()
Returns the amount of free cargo space on the ship.
Returns
A number value containing the free cargo bay space of the ship
function table<unsigned int, Squad>, table_t getHangar()
Returns the current hangar squads and misc info about the hangar. The squads are stored in a table of the format squads = {}; squads[index1] = squad1; squads[index2] = squad2; ... etc. The squad indices are used as keys, the value is a Squad class. The second value is information about the hangar, with a few properties such as its space, occupied space, etc. It's recommended to use printTable() to print the complete table for inspection.
Returns
returns 2 values: 1. A table holding the current squads of the ship; 2. a table containing more hangar info
function var... getHyperspaceProperties()
Returns the hyperspace range, if the ship can pass over rifts, hyperspace cooldown and if the hyperspace engine is currently impaired (blocked or distorted by enemies) .
Returns
returns 4 values: 1. A number containing the hyperspace range of the ship; 2. A boolean whether the ship can jump over rifts; 3. The hyperspace cooldown in seconds of the ship; 4. A boolean whether the hyperspace engine is currently impaired
function string getIcon()
function table<unsigned int, Squad>, table_t getLightweightHangar()
Returns the current hangar squads and misc info about the hangar. Lightweight version that will not return BlockPlans of fighters. The squads are stored in a table of the format squads = {}; squads[index1] = squad1; squads[index2] = squad2; ... etc. The squad indices are used as keys, the value is a Squad class. The second value is information about the hangar, with a few properties such as its space, occupied space, etc. It's recommended to use printTable() to print the complete table for inspection.
Returns
returns 2 values: 1. A table holding the current squads of the ship; 2. a table containing more hangar info
function Matrix getLocalPosition()
function string getOrderInfo()
function float getPaymentTime()
function BlockPlan getPlan()
function double getPlanValue()
function var getPlayerPiloted()
Returns whether the craft is currently being piloted by a player.
Returns
A bool value whether the craft is currently being piloted by a player.
function double getReconstructionValue()
function table<int, string> getScripts()
Returns the scripts that are currently attached to the ship, in the form of a table with key = scriptIndex, value = scriptPath.
Returns
A table containing script paths by script index
function var getScriptValue(string key)
Retrieves a custom value
Parameters
Returns
The value
function var getScriptValues()
Returns the script values of the ship. These are the values that can be set via the setValue() and getValue() functions.
Returns
A table containing the script values by name
function var getSecuredScriptValues()
Returns the secured values of all scripts attached to the ship. Contains a table per script. This table is the one that's passed to the script in the "restore(values)" function.
Returns
A table containing value tables by script index
function float, float getShields()
Returns the max shields and percentage of the shields of the craft.
Returns
2 number values: 1. The maximum shields, 2. the percentage of the craft's shield, range 0 to 1
function NamedFormat getStatusMessage()
function pair
Returns the currently equipped subsystems of the ship. The subsystems are stored in a table of the format subsystems = {}; subsystems[subsystem1] = {...}; subsystems[subsystem2] = {...}; ... etc. The keys of the returned table are the subsystems, the values are information about the subsystems. It's recommended to use printTable() to print the tables for inspection.
Returns
returns a table where the subsystems are the keys, and tables holding information about the subsystems are the values
function Format getTitle()
function TorpedoTemplate... getTorpedoes()
Returns the current torpedo shafts and misc info about the torpedo launcher. The shafts are stored in a table of the format shafts = {}; shafts[index1] = shaft1; shafts[index2] = shaft2; ... etc. The shaft indices are used as keys, the value is a TorpedoShaft class. Shaft with index -1 is the general torpedo storage. Note that the space for the shafts is an integer number of torpedoes, while the space for the general storage is torpedo space, which torpedoes take up and which can be extended with blocks. The second value is information about the launcher, with a few properties such as its space, occupied space, etc. It's recommended to use printTable() to print the complete table for inspection.
Returns
returns 2 values: 1. A table holding the current shafts of the ship; 2. a table containing more launcher info
function pair
Returns the currently equipped turrets of the ship. The turrets are stored in a table of the format turrets = {}; turrets[turret1] = {...}; turrets[turret2] = {...}; ... etc. The keys of the returned table are the turrets, the values are information about the turrets. It's recommended to use printTable() to print the tables for inspection.
Returns
returns a table where the turrets are the keys, and tables holding information about the turrets are the values
function bool getTurretSlotRequirementsFulfilled()
Returns a boolean whether the turret slot requirements of the craft are all fulfilled. That's not fulfilled when there aren't enough slots for all turrets.
Returns
A boolean whether the requirements are all fulfilled.
Callbacks Alliance [Client] Callbacks Alliance [Server] Callbacks Alliance [Server] Callbacks Entity Callbacks Galaxy Callbacks Player Callbacks Player [Client] Callbacks Sector Callbacks Server Callbacks
Command Entity FactionDatabase PlanGenerator Player Sector Server UsableInventoryItem
Boarding BspTree CargoBay CargoLoot ControlUnit CrewComponent DeletionTimer DirectFlightPhysics DockingClamps DockingParent DockingPositions Durability EnergySystem Engine FighterAI Hangar HyperspaceEngine InteractionText InventoryItemLoot Owner Physics Plan ReadOnlyBoarding ReadOnlyBspTree ReadOnlyCargoBay ReadOnlyControlUnit ReadOnlyCrew ReadOnlyDeletionTimer ReadOnlyEnergySystem ReadOnlyEngine ReadOnlyFighterAI ReadOnlyHangar ReadOnlyHyperspaceEngine ReadOnlyInteractionText ReadOnlyOwner ReadOnlyPhysics ReadOnlyPlan ReadOnlyShipAI ReadOnlyShipSystem ReadOnlyTorpedoAI [Server] [Client] [Server] [Client] ReadOnlyTorpedoAI [Server] [Client] [Server] [Client] ReadOnlyTorpedoLauncher ReadOnlyTurretBases ReadOnlyVelocity ReadOnlyWeapons ReadOnlyWormHole Shield ShipAI ShipSystem StructuralIntegrity SystemUpgradeLoot Thrusters Torpedo TorpedoAI TorpedoLauncher Turret TurretAI TurretBases Velocity Weapons WormHole
AllianceMember AllianceRank BlockPlan BlockPlanBlock BlockStatistics Box Captain Color ControlUnitSeat CraftDesign CraftStatsOverview Crew CrewMan CrewProfession DebugInfo dvec2 dvec3 dvec4 Entity EntityDescriptor FighterTemplate Format GameSettings Group HighResolutionTimer Inventory InventoryTurret ivec2 ivec3 ivec4 Language Mail Material Matrix ModManager NamedFormat PlanBspTree PlanetSpecifics PlanGenerationStage PlanPart PlanStyle PlayerId PluralForm Profiler QuadTree Random Rarity Ray ReadOnlyEntity Rect Relation Scenario SectorView Seed Sphere Squad SystemUpgradeTemplate Timer Tooltip TooltipLine TorpedoShaft TorpedoTemplate TradingGood TurretDesign TurretDesignPart TurretTemplate UsableInventoryItem Uuid VanillaInventoryItem vec2 vec3 vec4 Version Weapon
EntityIcon EntityTooltip PlanMesh ReadOnlyIcon ReadOnlyPlanMesh ReadOnlyScriptUI ReadOnlyTooltip ScriptUI
Achievements Alliance [Client] CameraKeyFrame CaptainSelectionItem Client ClientSettings ColorSelectionItem CraftDesignSelectionItem Faction [Client] Galaxy [Client] GalaxyMap GameInput GlowFX IconSelectionItem InputWindow InventoryReferenceSelectionItem InventorySelectionItem Keyboard LaserFX Mouse Music PixelIconSelectionItem Planet Player [Client] PlayerWindow RefractionFX Sector [Client] SelectionItem ShipDatabaseEntry [Client] SoundSource StrategyState TargetIndicator TooltipRenderer TurretDesignSelectionItem
AllianceEmblem AllianceTab ArrowLine Button [Client] [Client] Button [Client] [Client] CaptainIcon CaptainProfile CheckBox ComboBox ContextMenu CraftPortrait CrewBar Frame Hud InventorySelection Label Line ListBox ListBoxEx MapArrowLine MapIcon MultiLineTextBox NumbersBar Picture PlanDisplayer ProgressBar SavedDesignsSelection ScrollFrame Selection ShipWindow Slider StatisticsBar Tab TabbedWindow TextBox TextField TooltipDisplayer Tree UIArbitraryHorizontalSplitter UIArbitraryVerticalSplitter UIContainer UIElement UIGridSplitter UIHorizontalLister UIHorizontalMultiSplitter UIHorizontalSplitter UIOrganizer UIRect UIRenderer UIVerticalLister UIVerticalMultiSplitter UIVerticalSplitter ValueComboBox Window
EntityTransferrer FighterController Loot ReadOnlyEntityTransferrer ReadOnlyFighterController ReadOnlyLoot ReadOnlyTurretController ReadOnlyWreckageCreator TurretController WreckageCreator
Alliance [Server] Faction [Server] Galaxy [Server] Player [Server] ReadOnlySector Sector [Server] Server ShipDatabaseEntry [Server]
AIState AlliancePrivilege BeamShape BlockShading BlockStructure BlockType BlockType2 BoxType BuildError CaptainGenderId ChatChannel ChatMessageType ComponentType ControlAction ControlActionBit ControlStyle CoolingType CraftStatsOverviewStat CrewProfessionType CrewRank DamageSource DamageType DeletionType Difficulty EntityArrivalType EntityType FighterOrders FighterStartError FighterType FontType ImpactParticles InventoryItemType JumpError KeyboardKey ListBoxEntryType MalusReason MaterialType MoonType MouseButton PlanetType PlayerStateType ProjectileShape RarityType RelationStatus SavedDesignType ScenarioType SectorChangeType ShipAvailability SoundType StatsBonuses TargetIndicatorVisuals TransformationFeature TurretAutoFireMode TurretSlotType WeaponAppearance WeaponCategory
This is the official documentation for the scripting API of Avorion. This documentation is automatically generated and not necessarily complete. Depending on the context in which functions exist, some documentation such as descriptions, return values or variable names or types may be missing.
Work in Progress. Documentation of Avorion Version: 2.5.7 c8e4beec84f7